<%@page import="classes.Courses"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import ="readFromDB.GetCourse" %>
<%@ page import ="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>开始选课</title>
	<div">
    <span>位置：选课</span>
     <li><a href="http://localhost:8080/my_term_project_xuanke/student/student_home.jsp">返回主页</a>	</li>
     <li><a href="http://localhost:8080/my_term_project_xuanke/student/showCourse.jsp">查看课表</a>	</li>	
	 <li><a href="http://localhost:8080/my_term_project_xuanke/student/updatePW.jsp">修改密码</a></li>	
	 <li><a href="http://localhost:8080/my_term_project_xuanke/student/alter_phone.jsp">修改密保手机</a>	</li>
    <ul>
    </ul>
    </div>


		<%
		 request.setCharacterEncoding("UTF-8");
		 String message=String.valueOf((request.getSession().getAttribute("choose_course_message")));
	     message=message.replace("\n", " \\u000a");
		%>
		<script src="http://localhost:8080/my_term_project_xuanke/resource/paging.js">


		</script>	
		<script>
		
		var message="<%=message%>";
		if(message.length!=0&&message!="null"){
			alert(message);
		}
		
		</script>
		
		<%//复原
			request.getSession().setAttribute("choose_course_message","");
		%>		
<% 
	String StuID=String.valueOf((request.getSession().getAttribute("ID")));
	String action ="http://localhost:8080/my_term_project_xuanke/studentServlet?action=choose";
%>
<h2 align="center">欢迎学生：<%=StuID%>，开始选课吧</h2>

<style type="text/css">
	#show{
		width:900px;
		height:200px
	}
</style>
</head>
 <body onLoad="goPage(1,10);">
   <form name="chooseCourses" action="<%=action%>" method="post">
  <table id="show" border="1" align="center"  cellpadding="4" cellspacing="4">
       <tr>
         <th>课程编号</th>
         <th>课程名称</th>
         <th>授课教师</th>
         <th>先修课</th>
         <th>上课时间</th>
		 <th>上课地点</th>
		 <th>人数限制</th>
		 <th>已选人数</th>		
		 <th>选择</th> 		 
       </tr>
        <%
           GetCourse get=new GetCourse();
           List<Courses> list = get.getByTableName("course");  
           for(Courses course:list)
           {%>
         <tr>
              <td><%=course.getCuoId() %></td>
              <td><%=course.getCuoName() %></td>
              <td><%=course.getCuoTeacher()  %></td>
              <td><%=course.getCuoPro() %></td>
              <td><%=course.getCuoTime() %></td>
              <td><%=course.getCuoPosition() %></td>     
              <td><%=course.getCuoLimmit() %></td>
              <td><%=course.getCuoChoesd() %></td>
              <td><input type="checkbox" name="choose_this" value="<%=course.getCuoId() %>"/></td>
           </tr>
             <%}
        %> 
	<table align="right" style="margin:20px 400px 0px 20px">
     <tr><td> <div  id="barcon" name="barcon" ></div></td></tr>
	</table>
	
	
   <table  align="center" style="margin-top:60px">
      <tr>
      		<td><input type="submit" value="提交" /></td>    
      		<td><input type="reset" value="重置"/></td>    
      </tr>
   </table>
   </form>
</body>
</html>